class UsersFollowers
  attr_accessor :github

  def initialize(github)
    @github = github
  end

  def listFollowers(user=nil)
    url = (user != nil and user != @github.username) ?
        'users/%s/followers' % user : 'user/followers'
    @github.get(url)
  end

  def listFollowing(user=nil)
    url = (user != nil and user != @github.username) ?
        'users/%s/following' % user : 'user/following'
    @github.get(url)
  end

  def checkIfFollowing(user)
    @github.get('user/following/%s' % user)
  end

  def followUser(user)
    @github.put('user/following/%s' % user)
  end

  def unfollowUser(user)
    @github.delete('user/following/%s' % user)
  end
end